/*  1:   */ package org.intellij.lang.regexp.intention;
/*  2:   */ 
/*  3:   */

import com.intellij.codeInsight.intention.impl.QuickEditAction;
import com.intellij.lang.Language;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.intellij.lang.regexp.RegExpLanguage;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */
/* 20:   */ 
/* 21:   */ public class CheckRegExpIntentionAction
/* 22:   */   extends QuickEditAction
/* 23:   */   implements Iconable
/* 24:   */ {
/* 25:   */   public boolean isAvailable(@NotNull Project paramProject, Editor paramEditor, PsiFile paramPsiFile)
/* 26:   */   {
/* 27:44 */     if (paramProject == null) {
/* 28:44 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/lang/regexp/intention/CheckRegExpIntentionAction", "isAvailable" }));
/* 29:   */     }
/* 30:44 */     Pair localPair = getRangePair(paramPsiFile, paramEditor);
/* 31:46 */     if ((localPair != null) && (localPair.first != null))
/* 32:   */     {
/* 33:47 */       Language localLanguage1 = ((PsiElement)localPair.first).getLanguage();
/* 34:48 */       Language localLanguage2 = localLanguage1.getBaseLanguage();
/* 35:49 */       return (localLanguage1 == RegExpLanguage.INSTANCE) || (localLanguage2 == RegExpLanguage.INSTANCE);
/* 36:   */     }
/* 37:51 */     return false;
/* 38:   */   }
/* 39:   */   
/* 40:   */   protected boolean isShowInBalloon()
/* 41:   */   {
/* 42:56 */     return true;
/* 43:   */   }
/* 44:   */   
/* 45:   */   protected JComponent createBalloonComponent(PsiFile paramPsiFile, Ref<Balloon> paramRef)
/* 46:   */   {
/* 47:61 */     Project localProject = paramPsiFile.getProject();
/* 48:62 */     Document localDocument = PsiDocumentManager.getInstance(localProject).getDocument(paramPsiFile);
/* 49:63 */     if (localDocument != null) {
/* 50:64 */       return new CheckRegExpForm(new Pair(paramPsiFile, paramRef)).getRootPanel();
/* 51:   */     }
/* 52:66 */     return null;
/* 53:   */   }
/* 54:   */   
/* 55:   */   @NotNull
/* 56:   */   public String getText()
/* 57:   */   {
/* 58:72 */     String tmp2_0 = "Check RegExp";
/* 59:72 */     if (tmp2_0 == null) {
/* 60:72 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/intention/CheckRegExpIntentionAction", "getText" }));
/* 61:   */     }
/* 62:72 */     return tmp2_0;
/* 63:   */   }
/* 64:   */   
/* 65:   */   @NotNull
/* 66:   */   public String getFamilyName()
/* 67:   */   {
/* 68:78 */     String tmp4_1 = getText();
/* 69:78 */     if (tmp4_1 == null) {
/* 70:78 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/intention/CheckRegExpIntentionAction", "getFamilyName" }));
/* 71:   */     }
/* 72:78 */     return tmp4_1;
/* 73:   */   }
/* 74:   */   
/* 75:   */   public Icon getIcon(int paramInt)
/* 76:   */   {
/* 77:84 */     return RegExpLanguage.INSTANCE.getAssociatedFileType().getIcon();
/* 78:   */   }
/* 79:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.lang.regexp.intention.CheckRegExpIntentionAction

 * JD-Core Version:    0.7.0.1

 */